import { _decorator, Component, director, Label, Node, Tween, tween, Vec3 } from 'cc';
import { AudioManager, Audios } from '../AshFramework/Managers/AudioManager';
import Banner from '../Banner';

const { ccclass, property } = _decorator;

@ccclass('FailPanel')
export class FailPanel extends Component {
    Show() {
        Banner.Instance.ShowBannerAd();
        Banner.Instance.ShowCustomAd();
        this.node.setScale(0, 0, 0);
        Tween.stopAllByTarget(this.node);
        tween(this.node).to(0.5, { scale: Vec3.ONE }, { easing: `backOut` }).call(() => {
        }).start();
    }

    OnButtonClick() {
        AudioManager.PlaySound(Audios.ButtonClick);
        director.loadScene(director.getScene().name);
    }

    OnReturnButtonClick() {
        AudioManager.PlaySound(Audios.ButtonClick);
        director.loadScene("Start");
    }
}